package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.deptSchool;
import com.ruoyi.system.mapper.deptSchoolMapper;
import com.ruoyi.system.service.deptSchoolService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class deptSchoolServiceIml implements deptSchoolService
{
    @Autowired
    private deptSchoolMapper deptSchoolMapper;
    @Override
    public List<deptSchool> selectDeptSchool(deptSchool deptSchool,int grade) {
        System.out.println(grade);
        int highOfGrade=grade+30;
        int lowOfGrade=grade-30;
        List<deptSchool> deptSchools = deptSchoolMapper.selectDeptSchool(deptSchool, highOfGrade, lowOfGrade);
        if (lowOfGrade>0&&grade!=0){
            for (deptSchool deptSchool1:deptSchools){
                int department_grade = Integer.parseInt(deptSchool1.getTwenty_one_year_plan());
                if (Math.abs(department_grade-grade)<10){
                    deptSchool1.setRegistration_suggestions("稳定录取");
                    continue;
                }
                if ((department_grade-grade)>=10){
                    deptSchool1.setRegistration_suggestions("建议冲刺");
                    continue;
                }
                if ((grade-department_grade)>=10){
                    deptSchool1.setRegistration_suggestions("保底录取");
                    continue;
                }
            }
        }
        return deptSchools;
    }

    @Override
    public List<deptSchool> selectBySchool(String c_name, String d_name) {
        return deptSchoolMapper.selectBySchool(c_name,d_name);
    }
}
